package com.example.elastic.repository;

import com.example.elastic.document.User;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * @author zxs
 * @since 2022/4/20
 */
public interface UserRepository extends CrudRepository<User,String> {


    @Query("""
            {
              "query": {
                "range": {
                  "age": {
                    "gte": 10
                  }
                }
              },
              "post_filter": {
                "term": {
                  "random": "8"
                }
              }
            }
            """)
    List<User> customQuery();
}
